<html>
<title>if</title>
<body>
<h1>if</h1>
Runs a command but only if a given condition is satisfied.
<pre>
   <b>if</b> [<b>not</b>] <b>errorlevel</b> number command [options]
   <b>if</b> [<b>not</b>] string1<b>==</b>string2 command [options]
   <b>if</b> [<b>not</b>] <b>exist</b> [d:][path]filename command [options]
</pre>
<h2>Options</h2>
<pre>
   <b>not</b>
   With this, the command will be run if the condition is false.
   (Without this, the command will be run if the condition is true.)
   
   command
   This command that will be run if the condition is satisfied.

   options
   These will be passed to the command if it is run.
</pre>
<h2>Conditions</h2>
<pre>
   <b>errorlevel</b> number
   DOS Programs return a number when they exit, which sometimes contains
   information on whether the program was successful.
   If the last program to exit returned the given number, then the condition
   is true.

   string1<b>==</b>string2
   If the two strings of characters are equal, then the condition is true.

   <b>exist</b> [d:][path]filename
   If the given file is there, then the condition is true.
</pre>
<h2>See Also</h2>
<a href="index.htm">batch files</a>
<hr>
<address>
<b>Copyright &copy; 2003 Rob Platt</a></b>
<br>
This file forms part of The FreeDOS HTML Help Documentation, and is covered
under its terms: see <a href="../../index.htm#copying">index.htm</a><br>
</address>
</body>
</html>